<template>
  <div class="router-container">
    <div class="tab-header">
      <button @click="goRouter('/a')">跳转a页面</button>
      <button @click="goRouter('/b')">跳转b页面</button>
      <button @click="goRouter('/c')">跳转c页面</button>
    </div>
    <div class="body">
      <router-view></router-view>
    </div>
  </div>
</template>
<script setup>
import {} from "vue";
import { useRouter, useRoute } from "vue-router";

let router = useRouter();

//
console.log(useRoute());

function goRouter(path) {
  router.push({
    path,
    replace: true,
  });
  //   router.replace({
  //     path,
  //   });
}
</script>
<style scoped lang="less">
.router-container {
  width: 500px;
  height: 500px;
  border: 1px solid #dcdcdc;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  .tab-header {
    height: 50px;
    border-bottom: 1px solid #dcdcdc;
    display: flex;
    justify-content: space-around;
    align-items: center;
    button {
      height: 30px;
      cursor: pointer;
    }
    .body {
      box-sizing: border-box;
      padding: 20px;
    }
  }
}
</style>
